package com.hua.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hua.pojo.Canteen;
import com.hua.mapper.CanteenMapper;
import com.hua.pojo.User;
import com.hua.service.CanteenService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author hua
 * @since 2023-12-24
 */
@Service
public class CanteenServiceImpl extends ServiceImpl<CanteenMapper, Canteen> implements CanteenService {

    @Override
    public Map<String, Object> getCanteenList() {

        //添加查询条件
        QueryWrapper<Canteen> wrapper = new QueryWrapper<>();
        wrapper.orderByAsc("id"); // 根据id列进行升序排序
//        wrapper.select("id","canteen_name"); // 指定要查询的列

        //执行查询所有的饭堂信息
        List<Canteen> canteenList = this.baseMapper.selectList(wrapper);
        //把数据封装到map集合，data返回数据
        Map<String, Object> data = new HashMap<>();
        data.put("data",canteenList);
        return data;
    }
}
